Module shellutils
[hide private]

Module shellutils

source code

This library contains APIs for executing shell commands, for getting the exit status of the executed command, and for allowing multiple commands to run conditional on that exit status. It is initialized with a Shell Client, and then uses the client to run commands and get the results.

Classes [hide private]
  Command
Shell command base class
  Language
Language describes localized system configuration: locale, character sets, code pages etc
  OsLanguageDiscoverer
Discoverer determines language on destination system
  WindowsLanguageDiscoverer
Windows specific discoverer
  UnixLanguageDiscoverer
For Unix destination localization is not supported.
  OutputMatcher
  KeywordOutputMatcher
  EncodingContext
  OutputHandler
  SSHOutputHandler
  PowerShellOutputHandler
  NTCMDOutputHandler
  TelnetOutputHandler
  __CmdTransaction
Command transaction class.
  ShellFactory
This class manages shell creation for different shell protocols SSH, Telnet, or NTCMD.
  CommandNotFound
Exception case when command does not exists or cannot be recognized
  NoPermission
Exception case when client has no permission to execute command
  Shell
Class for managing Shell connections via SSH, Telnet, or NTCmd
  WinShell
Basic class for Windows shell
  CygwinShell
Cygwin Shell base class
  PowerShell
  UnixShell
Unix Shell base class
  MacShell
  VIOShell
Shell for Virtual I/O Server ( part of the IBM eServer p5 Advanced Power Virtualization hardware feature)
Functions [hide private]
 
ShellUtils(client, props=None, protocolName=None)
BaseClient or DynamicServiceFrameworkImpl, java.util.Properties, str -> Shell This method play role of factory method for backward compatibility and will be removed in further releases
source code
 
_extractCommandOutputAndReturnCode(buffer)
Extract output and return code information by splitting output into two parts by ERROR_CODE_PREFIX substring, used in unix shell
source code
 
getLanguageBundle(baseName, language, framework) source code
 
readLocalFile(localFilePath, encoding="utf-8")
Read file on the probe machine by the specified path
source code
 
deleteLocalFile(localFilePath)
Delete file on the probe machine by the specified path
source code
Variables [hide private]
  DDM_LINK_SYSTEM32_LOCATION = "%SystemDrive%"
  DDM_LINK_SYSTEM32_NAME = "ddm_link_system32"
  LOCALE_SPANISH = Locale("es", "", "")
  LOCALE_RUSSIAN = Locale("ru", "", "")
  LOCALE_GERMAN = Locale("de", "", "")
  LOCALE_FRENCH = Locale("fr", "", "")
  LOCALE_ITALIAN = Locale("it", "", "")
  LOCALE_PORTUGUESE = Locale("pt", "", "")
  LOCALE_CHINESE = Locale("cn", "", "")
  LOCALE_KOREAN = Locale("kr", "", "")
  LOCALE_DUTCH = Locale("nl", "", "")
  LANG_ENGLISH = Language(Locale.ENGLISH, 'eng', ('Cp1252',), (1...
  LANG_GERMAN = Language(Locale.GERMAN, 'ger', ('Cp1252', 'Cp850...
  LANG_SPANISH = Language(LOCALE_SPANISH, 'spa', ('Cp1252',), (1...
  LANG_RUSSIAN = Language(LOCALE_RUSSIAN, 'rus', ('Cp866', 'Cp12...
  LANG_JAPANESE = Language(Locale.JAPANESE, 'jap', ('MS932',), (...
  LANG_FRENCH = Language(Locale.FRENCH, 'fra', ('Cp1252',), (103...
  LANG_ITALIAN = Language(Locale.ITALIAN, 'ita', ('Cp1252',), (1...
  LANG_DUTCH = Language(LOCALE_DUTCH, 'nld', ('Cp1252',), (1043,...
  LANG_PORTUGUESE = Language(LOCALE_PORTUGUESE, 'prt', ('Cp1252'...
  LANG_CHINESE = Language(Locale.CHINESE, 'chn', ('MS936',), (20...
  LANG_KOREAN = Language(Locale.KOREAN, 'kor', ('MS949',), (1042...
  LANGUAGES = LANG_ENGLISH, LANG_GERMAN, LANG_SPANISH, LANG_RUSS...
  DEFAULT_LANGUAGE = Language(Locale.ENGLISH, 'eng', ('Cp1252',)...
Function Details [hide private]

ShellUtils(client, props=None, protocolName=None)

source code 

BaseClient or DynamicServiceFrameworkImpl, java.util.Properties, str -> Shell This method play role of factory method for backward compatibility and will be removed in further releases

Raises:
  • Exception - failed to detect OS

Deprecated: Use ShellFactory instead

_extractCommandOutputAndReturnCode(buffer)

source code 

Extract output and return code information by splitting output into two parts by ERROR_CODE_PREFIX substring, used in unix shell

Raises:
  • ValueError - No return code information found

readLocalFile(localFilePath, encoding="utf-8")

source code 

Read file on the probe machine by the specified path

Raises:
  • ValueError - specified localFilePath is empty

Deprecated: Use methods from file system module instead

deleteLocalFile(localFilePath)

source code 

Delete file on the probe machine by the specified path

Raises:
  • ValueError - specified localFilePath is empty

Deprecated: Use methods from file system module instead


Variables Details [hide private]

LANG_ENGLISH

Value:
Language(Locale.ENGLISH, 'eng', ('Cp1252',), (1033,), 437)

LANG_GERMAN

Value:
Language(Locale.GERMAN, 'ger', ('Cp1252', 'Cp850'), (1031,), 850)

LANG_SPANISH

Value:
Language(LOCALE_SPANISH, 'spa', ('Cp1252',), (1034, 3082,))

LANG_RUSSIAN

Value:
Language(LOCALE_RUSSIAN, 'rus', ('Cp866', 'Cp1251'), (1049,), 866)

LANG_JAPANESE

Value:
Language(Locale.JAPANESE, 'jap', ('MS932',), (1041,), 932)

LANG_FRENCH

Value:
Language(Locale.FRENCH, 'fra', ('Cp1252',), (1036,), 850)

LANG_ITALIAN

Value:
Language(Locale.ITALIAN, 'ita', ('Cp1252',), (1040,), 850)

LANG_DUTCH

Value:
Language(LOCALE_DUTCH, 'nld', ('Cp1252',), (1043,), 850)

LANG_PORTUGUESE

Value:
Language(LOCALE_PORTUGUESE, 'prt', ('Cp1252',), (1046,), 850)

LANG_CHINESE

Value:
Language(Locale.CHINESE, 'chn', ('MS936',), (2052,), 936)

LANG_KOREAN

Value:
Language(Locale.KOREAN, 'kor', ('MS949',), (1042,), 949)

LANGUAGES

Value:
LANG_ENGLISH, LANG_GERMAN, LANG_SPANISH, LANG_RUSSIAN, LANG_JAPANESE, \
LANG_FRENCH, LANG_ITALIAN, LANG_PORTUGUESE, LANG_CHINESE, LANG_KOREAN,\
 LANG_DUTCH

DEFAULT_LANGUAGE

Value:
Language(Locale.ENGLISH, 'eng', ('Cp1252',), (1033,), 437)